<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>借阅《 [[${book.name}]]》</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <script th:src="@{/js/jquery-3.2.1.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <style>
        body {
            background-color: rgb(240, 242, 245);
        }
    </style>

</head>
<body>
<div th:replace="components/adminPublicComponents::topbar"></div>

<div class="col-xs-6 col-md-offset-3" style="position: relative; margin-top:15%">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">借阅《 [[${book.name}]]》</h3>
        </div>
        <div class="panel-body">
            <form th:action="@{/lendbookdo/borrowBookDo(bookId=${book.bookId})}" method="post" id="lendbook">
                <div class="input-group">
                    <span class="input-group-addon">书名</span>
                    <input type="text" readonly="readonly" class="form-control" name="name" id="name" th:value="${book.name}">
                </div>
                <br/>
                <div class="input-group">
                    <span class="input-group-addon">读者证号</span>
                    <input type="text" class="form-control" name="readerId" id="readerId" placeholder="借阅人读者证号">
                </div>
                <br/>
                <input type="submit" value="确定" class="btn btn-success btn-sm text-left">
                <script>
                    function mySubmit(flag) {
                        return flag;
                    }

                    $("#lendbook").submit(function () {
                        if ($("#name").val() == '' || $("#readerId").val() == '') {
                            alert("请填入读者证号信息！");
                            return mySubmit(false);
                        }
                    })
                </script>
            </form>
        </div>
    </div>

</div>

</body>
</html>
